package com.calvin.study.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Binding.DestinationType;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {


	// 库存预占队列
	@Bean
	public Queue storageReservedQueue() {
		return new Queue("storage.reserved.queue", true, false, false);
	}

	@Bean
	public TopicExchange storageEventExchange() {
		return new TopicExchange("storage-event-exchange", true, false);
	}

	@Bean
	public Binding storageReservedBinding() {
		return new Binding("storage.reserved.queue", DestinationType.QUEUE, "storage-event-exchange",
				"storage.reserved", null);
	}


}
